package com.edu.servlet;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.edu.bean.Book;
import com.edu.service.BookService;
import com.edu.service.UserService;
import com.edu.service.impl.BookServiceImpl;
import com.edu.service.impl.UserServiceImpl;


@WebServlet("/changeStyle.do")
public class ChangeStyleServlet extends HttpServlet {
	

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String style = request.getParameter("style");
		Cookie cookie = null;
		if("1".equals(style)){
			cookie = new Cookie("style","book1.css");
		}else if("2".equals(style)){
			cookie = new Cookie("style","book2.css");
		}
		cookie.setMaxAge(60*60*24*365);
		response.addCookie(cookie);
		response.sendRedirect("book.jsp");
	}

}
